using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Husb.WinForm.Controls
{
    public class DataGridViewExImageListColumn : DataGridViewColumn
    {
        private ImageList images;

        public DataGridViewExImageListColumn()
            : base(new DataGridViewExImageListCell())
        {
            this.images = new ImageList();
        }

        public ImageList Images
        {
            get
            {
                return this.images;
            }
            set
            {
                this.images = value;
            }
        }

        public override DataGridViewCell CellTemplate
        {
            get
            {
                return base.CellTemplate;
            }
            set
            {
                if (value != null && !value.GetType().IsAssignableFrom(typeof(DataGridViewExImageListCell)))
                {
                    throw new InvalidCastException("Must be a DataGridViewExImageListCell");
                }
                base.CellTemplate = value;
            }
        }

        public override object Clone()
        {
            DataGridViewExImageListColumn newCol = (DataGridViewExImageListColumn)base.Clone();
            newCol.images = this.images;
            return newCol;

            //return base.Clone();
        }
    }
}
